unit schemaDAO;

Interface
Uses
  AdoDB,Forms,windows,db,sysutils,AbstractDAO;
Type
TAbstracttables=Class(TAbstractModel)
  Private
    Fid : integer;
    Fseq : integer;
    Fname : string;
    Fcomments : string;
  Protected
    procedure Setid(value:integer);
    procedure Setseq(value:integer);
    procedure Setname(value:string);
    procedure Setcomments(value:string);
  Public
    function Clone:TAbstractModel;override;
    property id:integer read Fid write Setid;
    property seq:integer read Fseq write Setseq;
    property name:string read Fname write Setname;
    property comments:string read Fcomments write Setcomments;
end;
Ttables=Class(TAbstracttables)
end;
TtablesDAO=Class(TAbstractDBDAO)
private
  FTableName:string;
protected
  procedure SetTableName(value:string);
public
  function DoInsert(value:TAbstractModel;q1:TDataSet):Boolean;Override;
  function DoUpdate(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function DoDelete(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function DoSelect(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function Retrieve(value:TAbstractModel;q1:TDataSet):Boolean;Override;
  function SetValue(value:TAbstractModel;q1:TDataSet):Boolean;Override;
published
  property TableName:string read FTableName write SetTableName;
end;
TAbstractcolumns=Class(TAbstractModel)
  Private
    Fid : integer;
    Fcorder : integer;
    Ftable_id : integer;
    Fname : string;
    Fdatatype : string;
    Fclength : integer;
    Fcprecision : integer;
    Fnn : boolean;
    FAi : boolean;
    FPk : boolean;
    Fcdefault : string;
    Fshowname : string;
    Fwidth : integer;
    Fedittype : string;
    Fvisible : boolean;
    Fcomments : string;
  Protected
    procedure Setid(value:integer);
    procedure Setcorder(value:integer);
    procedure Settable_id(value:integer);
    procedure Setname(value:string);
    procedure Setdatatype(value:string);
    procedure Setclength(value:integer);
    procedure Setcprecision(value:integer);
    procedure Setnn(value:boolean);
    procedure SetAi(value:boolean);
    procedure SetPk(value:boolean);
    procedure Setcdefault(value:string);
    procedure Setshowname(value:string);
    procedure Setwidth(value:integer);
    procedure Setedittype(value:string);
    procedure Setvisible(value:boolean);
    procedure Setcomments(value:string);
  Public
    function Clone:TAbstractModel;override;
    property id:integer read Fid write Setid;
    property corder:integer read Fcorder write Setcorder;
    property table_id:integer read Ftable_id write Settable_id;
    property name:string read Fname write Setname;
    property datatype:string read Fdatatype write Setdatatype;
    property clength:integer read Fclength write Setclength;
    property cprecision:integer read Fcprecision write Setcprecision;
    property nn:boolean read Fnn write Setnn;
    property Ai:boolean read FAi write SetAi;
    property Pk:boolean read FPk write SetPk;
    property cdefault:string read Fcdefault write Setcdefault;
    property showname:string read Fshowname write Setshowname;
    property width:integer read Fwidth write Setwidth;
    property edittype:string read Fedittype write Setedittype;
    property visible:boolean read Fvisible write Setvisible;
    property comments:string read Fcomments write Setcomments;
end;
Tcolumns=Class(TAbstractcolumns)
end;
TcolumnsDAO=Class(TAbstractDBDAO)
private
  FTableName:string;
protected
  procedure SetTableName(value:string);
public
  function DoInsert(value:TAbstractModel;q1:TDataSet):Boolean;Override;
  function DoUpdate(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function DoDelete(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function DoSelect(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function Retrieve(value:TAbstractModel;q1:TDataSet):Boolean;Override;
  function SetValue(value:TAbstractModel;q1:TDataSet):Boolean;Override;
published
  property TableName:string read FTableName write SetTableName;
end;
TAbstractindexes=Class(TAbstractModel)
  Private
    Fid : integer;
    Ftable_id : integer;
    Fname : string;
    FIndextype : string;
    Fcolumn_id : integer;
    Fcolumn_seq : integer;
    Fcorder : integer;
    Fcomments : string;
  Protected
    procedure Setid(value:integer);
    procedure Settable_id(value:integer);
    procedure Setname(value:string);
    procedure SetIndextype(value:string);
    procedure Setcolumn_id(value:integer);
    procedure Setcolumn_seq(value:integer);
    procedure Setcorder(value:integer);
    procedure Setcomments(value:string);
  Public
    function Clone:TAbstractModel;override;
    property id:integer read Fid write Setid;
    property table_id:integer read Ftable_id write Settable_id;
    property name:string read Fname write Setname;
    property Indextype:string read FIndextype write SetIndextype;
    property column_id:integer read Fcolumn_id write Setcolumn_id;
    property column_seq:integer read Fcolumn_seq write Setcolumn_seq;
    property corder:integer read Fcorder write Setcorder;
    property comments:string read Fcomments write Setcomments;
end;
Tindexes=Class(TAbstractindexes)
end;
TindexesDAO=Class(TAbstractDBDAO)
private
  FTableName:string;
protected
  procedure SetTableName(value:string);
public
  function DoInsert(value:TAbstractModel;q1:TDataSet):Boolean;Override;
  function DoUpdate(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function DoDelete(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function DoSelect(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function Retrieve(value:TAbstractModel;q1:TDataSet):Boolean;Override;
  function SetValue(value:TAbstractModel;q1:TDataSet):Boolean;Override;
published
  property TableName:string read FTableName write SetTableName;
end;
TAbstractfrKeys=Class(TAbstractModel)
  Private
    Fid : integer;
    Ftable_id : integer;
    Fname : string;
    Fcolumn_id : integer;
    Frefer_table_id : integer;
    Frefer_column_id : integer;
    Fcomments : string;
    Fsubtable : boolean;
  Protected
    procedure Setid(value:integer);
    procedure Settable_id(value:integer);
    procedure Setname(value:string);
    procedure Setcolumn_id(value:integer);
    procedure Setrefer_table_id(value:integer);
    procedure Setrefer_column_id(value:integer);
    procedure Setcomments(value:string);
    procedure Setsubtable(value:boolean);
  Public
    function Clone:TAbstractModel;override;
    property id:integer read Fid write Setid;
    property table_id:integer read Ftable_id write Settable_id;
    property name:string read Fname write Setname;
    property column_id:integer read Fcolumn_id write Setcolumn_id;
    property refer_table_id:integer read Frefer_table_id write Setrefer_table_id;
    property refer_column_id:integer read Frefer_column_id write Setrefer_column_id;
    property comments:string read Fcomments write Setcomments;
    property subtable:boolean read Fsubtable write Setsubtable;
end;
TfrKeys=Class(TAbstractfrKeys)
end;
TfrKeysDAO=Class(TAbstractDBDAO)
private
  FTableName:string;
protected
  procedure SetTableName(value:string);
public
  function DoInsert(value:TAbstractModel;q1:TDataSet):Boolean;Override;
  function DoUpdate(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function DoDelete(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function DoSelect(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function Retrieve(value:TAbstractModel;q1:TDataSet):Boolean;Override;
  function SetValue(value:TAbstractModel;q1:TDataSet):Boolean;Override;
published
  property TableName:string read FTableName write SetTableName;
end;
TAbstractsystypesx=Class(TAbstractModel)
  Private
    Fxtype : integer;
    Fname : string;
  Protected
    procedure Setxtype(value:integer);
    procedure Setname(value:string);
  Public
    function Clone:TAbstractModel;override;
    property xtype:integer read Fxtype write Setxtype;
    property name:string read Fname write Setname;
end;
Tsystypesx=Class(TAbstractsystypesx)
end;
TsystypesxDAO=Class(TAbstractDBDAO)
private
  FTableName:string;
protected
  procedure SetTableName(value:string);
public
  function DoInsert(value:TAbstractModel;q1:TDataSet):Boolean;Override;
  function DoUpdate(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function DoDelete(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function DoSelect(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function Retrieve(value:TAbstractModel;q1:TDataSet):Boolean;Override;
  function SetValue(value:TAbstractModel;q1:TDataSet):Boolean;Override;
published
  property TableName:string read FTableName write SetTableName;
end;
TAbstractusertypes=Class(TAbstractModel)
  Private
    Fid : integer;
    Fname : string;
    Fxtype : integer;
    Ftdefault : integer;
    Fallownulls : boolean;
    Fprec : integer;
    Fscale : integer;
  Protected
    procedure Setid(value:integer);
    procedure Setname(value:string);
    procedure Setxtype(value:integer);
    procedure Settdefault(value:integer);
    procedure Setallownulls(value:boolean);
    procedure Setprec(value:integer);
    procedure Setscale(value:integer);
  Public
    function Clone:TAbstractModel;override;
    property id:integer read Fid write Setid;
    property name:string read Fname write Setname;
    property xtype:integer read Fxtype write Setxtype;
    property tdefault:integer read Ftdefault write Settdefault;
    property allownulls:boolean read Fallownulls write Setallownulls;
    property prec:integer read Fprec write Setprec;
    property scale:integer read Fscale write Setscale;
end;
Tusertypes=Class(TAbstractusertypes)
end;
TusertypesDAO=Class(TAbstractDBDAO)
private
  FTableName:string;
protected
  procedure SetTableName(value:string);
public
  function DoInsert(value:TAbstractModel;q1:TDataSet):Boolean;Override;
  function DoUpdate(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function DoDelete(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function DoSelect(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function Retrieve(value:TAbstractModel;q1:TDataSet):Boolean;Override;
  function SetValue(value:TAbstractModel;q1:TDataSet):Boolean;Override;
published
  property TableName:string read FTableName write SetTableName;
end;
TAbstractdefaults=Class(TAbstractModel)
  Private
    Fid : integer;
    Fname : string;
    Fdtext : Variant;
  Protected
    procedure Setid(value:integer);
    procedure Setname(value:string);
    procedure Setdtext(value:Variant);
  Public
    function Clone:TAbstractModel;override;
    property id:integer read Fid write Setid;
    property name:string read Fname write Setname;
    property dtext:Variant read Fdtext write Setdtext;
end;
Tdefaults=Class(TAbstractdefaults)
end;
TdefaultsDAO=Class(TAbstractDBDAO)
private
  FTableName:string;
protected
  procedure SetTableName(value:string);
public
  function DoInsert(value:TAbstractModel;q1:TDataSet):Boolean;Override;
  function DoUpdate(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function DoDelete(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function DoSelect(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function Retrieve(value:TAbstractModel;q1:TDataSet):Boolean;Override;
  function SetValue(value:TAbstractModel;q1:TDataSet):Boolean;Override;
published
  property TableName:string read FTableName write SetTableName;
end;
TAbstracttrigers=Class(TAbstractModel)
  Private
    Fid : integer;
    Fname : string;
    Ftable_id : integer;
    Fdtext : Variant;
  Protected
    procedure Setid(value:integer);
    procedure Setname(value:string);
    procedure Settable_id(value:integer);
    procedure Setdtext(value:Variant);
  Public
    function Clone:TAbstractModel;override;
    property id:integer read Fid write Setid;
    property name:string read Fname write Setname;
    property table_id:integer read Ftable_id write Settable_id;
    property dtext:Variant read Fdtext write Setdtext;
end;
Ttrigers=Class(TAbstracttrigers)
end;
TtrigersDAO=Class(TAbstractDBDAO)
private
  FTableName:string;
protected
  procedure SetTableName(value:string);
public
  function DoInsert(value:TAbstractModel;q1:TDataSet):Boolean;Override;
  function DoUpdate(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function DoDelete(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function DoSelect(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function Retrieve(value:TAbstractModel;q1:TDataSet):Boolean;Override;
  function SetValue(value:TAbstractModel;q1:TDataSet):Boolean;Override;
published
  property TableName:string read FTableName write SetTableName;
end;
TAbstractviews=Class(TAbstractModel)
  Private
    Fid : integer;
    Fname : string;
    Fdtext : Variant;
  Protected
    procedure Setid(value:integer);
    procedure Setname(value:string);
    procedure Setdtext(value:Variant);
  Public
    function Clone:TAbstractModel;override;
    property id:integer read Fid write Setid;
    property name:string read Fname write Setname;
    property dtext:Variant read Fdtext write Setdtext;
end;
Tviews=Class(TAbstractviews)
end;
TviewsDAO=Class(TAbstractDBDAO)
private
  FTableName:string;
protected
  procedure SetTableName(value:string);
public
  function DoInsert(value:TAbstractModel;q1:TDataSet):Boolean;Override;
  function DoUpdate(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function DoDelete(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function DoSelect(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function Retrieve(value:TAbstractModel;q1:TDataSet):Boolean;Override;
  function SetValue(value:TAbstractModel;q1:TDataSet):Boolean;Override;
published
  property TableName:string read FTableName write SetTableName;
end;
TAbstractprocedures=Class(TAbstractModel)
  Private
    Fid : integer;
    Fname : string;
    Fdtext : Variant;
  Protected
    procedure Setid(value:integer);
    procedure Setname(value:string);
    procedure Setdtext(value:Variant);
  Public
    function Clone:TAbstractModel;override;
    property id:integer read Fid write Setid;
    property name:string read Fname write Setname;
    property dtext:Variant read Fdtext write Setdtext;
end;
Tprocedures=Class(TAbstractprocedures)
end;
TproceduresDAO=Class(TAbstractDBDAO)
private
  FTableName:string;
protected
  procedure SetTableName(value:string);
public
  function DoInsert(value:TAbstractModel;q1:TDataSet):Boolean;Override;
  function DoUpdate(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function DoDelete(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function DoSelect(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;Override;
  function Retrieve(value:TAbstractModel;q1:TDataSet):Boolean;Override;
  function SetValue(value:TAbstractModel;q1:TDataSet):Boolean;Override;
published
  property TableName:string read FTableName write SetTableName;
end;
var
  tables:TAbstracttables;
  tablesDAO:TtablesDAO;
  columns:TAbstractcolumns;
  columnsDAO:TcolumnsDAO;
  indexes:TAbstractindexes;
  indexesDAO:TindexesDAO;
  frKeys:TAbstractfrKeys;
  frKeysDAO:TfrKeysDAO;
  systypesx:TAbstractsystypesx;
  systypesxDAO:TsystypesxDAO;
  usertypes:TAbstractusertypes;
  usertypesDAO:TusertypesDAO;
  defaults:TAbstractdefaults;
  defaultsDAO:TdefaultsDAO;
  trigers:TAbstracttrigers;
  trigersDAO:TtrigersDAO;
  views:TAbstractviews;
  viewsDAO:TviewsDAO;
  procedures:TAbstractprocedures;
  proceduresDAO:TproceduresDAO;
 implementation
//-- Abstracttables
function TAbstracttables.Clone:TAbstractModel;
begin
  result:=TAbstracttables.create;
end;
Procedure TAbstracttables.Setid(value : integer);
begin
  Fid:=value;
end;
Procedure TAbstracttables.Setseq(value : integer);
begin
  Fseq:=value;
end;
Procedure TAbstracttables.Setname(value : string);
begin
  Fname:=value;
end;
Procedure TAbstracttables.Setcomments(value : string);
begin
  Fcomments:=value;
end;
procedure TtablesDAO.SetTableName(value:string);
Begin
  FTableName:=value
End;
function TtablesDAO.DoInsert(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
    with qp do
    Begin
      close;
      SQL.Clear;
      SQL.add('Insert Into tables');
      SQL.add( '(seq,name,comments)');
      SQL.Add(' values( :seq,:name,:comments)');
      SetParamValue('seq', (value as TAbstracttables).seq);
      SetParamValue('name', (value as TAbstracttables).name);
      SetParamValue('comments', (value as TAbstracttables).comments);
//      SQL.Add('select SCOPE_IDENTITY() as id');
//      Open;
      ExecSql;
      SQL.Clear;
      SQL.Add('select max(id) as id from tables');
      open;
      (value as TAbstracttables).id:=  FieldByName('id').AsInteger;
      result:=true;
    end;
  finally
    qp.free;
  end;
End;
function TtablesDAO.DoUpdate(value:TAbstractModel;q1:TDataSet;Conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
    with qp do
    Begin
      close;
      SQL.Clear;
      SQL.Add('Update tables  set ');
      SQL.add('seq=:seq,name=:name,comments=:comments ');
      if ( conditions='') then
      begin
        SQL.Add(' where id=:id');
       SetParamValue('id', (value as TAbstracttables).id);
      end else
      begin
        SQL.ADD( 'where '+conditions);
      end;
       SetParamValue('seq', (value as TAbstracttables).seq);
       SetParamValue('name', (value as TAbstracttables).name);
       SetParamValue('comments', (value as TAbstracttables).comments);
      ExecSQL;
      result:=True;
    end;
  finally
    qp.free;
  end;
End;
function TtablesDAO.DoDelete(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
  with qp do
  Begin
    close;
    SQL.Clear;
    if( conditions='') then
    begin
      SQL.Add('Delete from tables where id=:id');
      SetParamValue('id',( value as TAbstracttables).id);
    end else
      SQL.Add('Delete from tables where  '+conditions);
    ExecSQL;
    result:=true;
  end;
  finally
    qp.free;
  end;
End;
function TtablesDAO.DoSelect(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
  with qp do
  Begin
    close;
    SQL.Clear;
    s1 := 'Select * from tables  ';
    if(conditions='') then
    begin
      s1 := s1 + ' where id=:id';
      SQL.Add(s1);
      SetParamValue('id',(value As TAbstracttables).id);
    end else
    begin
       s1:=s1+' where '+conditions;
       SQL.Add(s1);
    end;
    Open;
    result:=True;
  end;
  finally
    qp.free;
  end;
End;
function TtablesDAO.Retrieve(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
Begin
  with q1 do
  Begin
    (value As TAbstracttables).id:=FieldByName('id').AsInteger;
    (value As TAbstracttables).seq:=FieldByName('seq').AsInteger;
    (value As TAbstracttables).name:=Trim(FieldByName('name').AsString);
    (value As TAbstracttables).comments:=Trim(FieldByName('comments').AsString);
  end;
End;
function TtablesDAO.SetValue(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
Begin
  with q1 do
  Begin
    FieldByName('seq').AsInteger:= (value As TAbstracttables).seq;
    FieldByName('name').AsString:= (value As TAbstracttables).name;
    FieldByName('comments').AsString:= (value As TAbstracttables).comments;
  end;
End;
//-- Abstractcolumns
function TAbstractcolumns.Clone:TAbstractModel;
begin
  result:=TAbstractcolumns.create;
end;
Procedure TAbstractcolumns.Setid(value : integer);
begin
  Fid:=value;
end;
Procedure TAbstractcolumns.Setcorder(value : integer);
begin
  Fcorder:=value;
end;
Procedure TAbstractcolumns.Settable_id(value : integer);
begin
  Ftable_id:=value;
end;
Procedure TAbstractcolumns.Setname(value : string);
begin
  Fname:=value;
end;
Procedure TAbstractcolumns.Setdatatype(value : string);
begin
  Fdatatype:=value;
end;
Procedure TAbstractcolumns.Setclength(value : integer);
begin
  Fclength:=value;
end;
Procedure TAbstractcolumns.Setcprecision(value : integer);
begin
  Fcprecision:=value;
end;
Procedure TAbstractcolumns.Setnn(value : boolean);
begin
  Fnn:=value;
end;
Procedure TAbstractcolumns.SetAi(value : boolean);
begin
  FAi:=value;
end;
Procedure TAbstractcolumns.SetPk(value : boolean);
begin
  FPk:=value;
end;
Procedure TAbstractcolumns.Setcdefault(value : string);
begin
  Fcdefault:=value;
end;
Procedure TAbstractcolumns.Setshowname(value : string);
begin
  Fshowname:=value;
end;
Procedure TAbstractcolumns.Setwidth(value : integer);
begin
  Fwidth:=value;
end;
Procedure TAbstractcolumns.Setedittype(value : string);
begin
  Fedittype:=value;
end;
Procedure TAbstractcolumns.Setvisible(value : boolean);
begin
  Fvisible:=value;
end;
Procedure TAbstractcolumns.Setcomments(value : string);
begin
  Fcomments:=value;
end;
procedure TcolumnsDAO.SetTableName(value:string);
Begin
  FTableName:=value
End;
function TcolumnsDAO.DoInsert(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
    with qp do
    Begin
      close;
      SQL.Clear;
      SQL.add('Insert Into columns');
      SQL.add('(table_id,name,datatype,clength,cprecision,');
      SQL.add('nn,Ai,Pk,cdefault,showname,');
      SQL.add('width,edittype,visible,comments,corder)');
      SQL.add(' values( :table_id,:name,:datatype,:clength,:cprecision,');
      SQL.add(':nn,:Ai,:Pk,:cdefault,:showname,');
      SQL.add(':width,:edittype,:visible,:comments,:corder)');
      SetParamValue('table_id', (value as TAbstractcolumns).table_id);
      SetParamValue('name', (value as TAbstractcolumns).name);
      SetParamValue('datatype', (value as TAbstractcolumns).datatype);
      SetParamValue('clength', (value as TAbstractcolumns).clength);
      SetParamValue('cprecision', (value as TAbstractcolumns).cprecision);
      SetParamValue('nn', (value as TAbstractcolumns).nn);
      SetParamValue('Ai', (value as TAbstractcolumns).Ai);
      SetParamValue('Pk', (value as TAbstractcolumns).Pk);
      SetParamValue('cdefault', (value as TAbstractcolumns).cdefault);
      SetParamValue('showname', (value as TAbstractcolumns).showname);
      SetParamValue('width', (value as TAbstractcolumns).width);
      SetParamValue('edittype', (value as TAbstractcolumns).edittype);
      SetParamValue('visible', (value as TAbstractcolumns).visible);
      SetParamValue('comments', (value as TAbstractcolumns).comments);
      SetParamValue('corder', (value as TAbstractcolumns).corder);
      SQL.Add('select SCOPE_IDENTITY() as id');
      Open;
      (value as TAbstractcolumns).id:=  FieldByName('id').AsInteger;
      result:=true;
    end;
  finally
    qp.free;
  end;
End;
function TcolumnsDAO.DoUpdate(value:TAbstractModel;q1:TDataSet;Conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
    with qp do
    Begin
      close;
      SQL.Clear;
      SQL.Add('Update columns  set ');
      SQL.add('table_id=:table_id,name=:name,datatype=:datatype,clength=:clength,cprecision=:cprecision,');
      SQL.add('nn=:nn,Ai=:Ai,Pk=:Pk,cdefault=:cdefault,showname=:showname,');
      SQL.add('width=:width,edittype=:edittype,visible=:visible,comments=:comments,corder=:corder ');
      if ( conditions='') then
      begin
        SQL.Add(' where id=:id');
       SetParamValue('id', (value as TAbstractcolumns).id);
      end else
      begin
        SQL.ADD( 'where '+conditions);
      end;
       SetParamValue('table_id', (value as TAbstractcolumns).table_id);
       SetParamValue('name', (value as TAbstractcolumns).name);
       SetParamValue('datatype', (value as TAbstractcolumns).datatype);
       SetParamValue('clength', (value as TAbstractcolumns).clength);
       SetParamValue('cprecision', (value as TAbstractcolumns).cprecision);
       SetParamValue('nn', (value as TAbstractcolumns).nn);
       SetParamValue('Ai', (value as TAbstractcolumns).Ai);
       SetParamValue('Pk', (value as TAbstractcolumns).Pk);
       SetParamValue('cdefault', (value as TAbstractcolumns).cdefault);
       SetParamValue('showname', (value as TAbstractcolumns).showname);
       SetParamValue('width', (value as TAbstractcolumns).width);
       SetParamValue('edittype', (value as TAbstractcolumns).edittype);
       SetParamValue('visible', (value as TAbstractcolumns).visible);
       SetParamValue('comments', (value as TAbstractcolumns).comments);
       SetParamValue('corder', (value as TAbstractcolumns).corder);
      ExecSQL;
      result:=True;
    end;
  finally
    qp.free;
  end;
End;
function TcolumnsDAO.DoDelete(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
  with qp do
  Begin
    close;
    SQL.Clear;
    if( conditions='') then
    begin
      SQL.Add('Delete from columns where id=:id');
      SetParamValue('id',( value as TAbstractcolumns).id);
    end else
      SQL.Add('Delete from columns where  '+conditions);
    ExecSQL;
    result:=true;
  end;
  finally
    qp.free;
  end;
End;
function TcolumnsDAO.DoSelect(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
  with qp do
  Begin
    close;
    SQL.Clear;
    s1 := 'Select * from columns  ';
    if(conditions='') then
    begin
      s1 := s1 + ' where id=:id';
      SQL.Add(s1);
      SetParamValue('id',(value As TAbstractcolumns).id);
    end else
    begin
       s1:=s1+' where '+conditions;
       SQL.Add(s1);
    end;
    Open;
    result:=True;
  end;
  finally
    qp.free;
  end;
End;
function TcolumnsDAO.Retrieve(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
Begin
  with q1 do
  Begin
    (value As TAbstractcolumns).id:=FieldByName('id').AsInteger;
    (value As TAbstractcolumns).corder:=FieldByName('corder').AsInteger;
    (value As TAbstractcolumns).table_id:=FieldByName('table_id').AsInteger;
    (value As TAbstractcolumns).name:=Trim(FieldByName('name').AsString);
    (value As TAbstractcolumns).datatype:=Trim(FieldByName('datatype').AsString);
    (value As TAbstractcolumns).clength:=FieldByName('clength').AsInteger;
    (value As TAbstractcolumns).cprecision:=FieldByName('cprecision').AsInteger;
    (value As TAbstractcolumns).nn:=FieldByName('nn').AsBoolean;
    (value As TAbstractcolumns).Ai:=FieldByName('Ai').AsBoolean;
    (value As TAbstractcolumns).Pk:=FieldByName('Pk').AsBoolean;
    (value As TAbstractcolumns).cdefault:=Trim(FieldByName('cdefault').AsString);
    (value As TAbstractcolumns).showname:=Trim(FieldByName('showname').AsString);
    (value As TAbstractcolumns).width:=FieldByName('width').AsInteger;
    (value As TAbstractcolumns).edittype:=Trim(FieldByName('edittype').AsString);
    (value As TAbstractcolumns).visible:=FieldByName('visible').AsBoolean;
    (value As TAbstractcolumns).comments:=Trim(FieldByName('comments').AsString);
  end;
End;
function TcolumnsDAO.SetValue(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
Begin
  with q1 do
  Begin
    FieldByName('corder').AsInteger:= (value As TAbstractcolumns).corder;
    FieldByName('table_id').AsInteger:= (value As TAbstractcolumns).table_id;
    FieldByName('name').AsString:= (value As TAbstractcolumns).name;
    FieldByName('datatype').AsString:= (value As TAbstractcolumns).datatype;
    FieldByName('clength').AsInteger:= (value As TAbstractcolumns).clength;
    FieldByName('cprecision').AsInteger:= (value As TAbstractcolumns).cprecision;
    FieldByName('nn').AsBoolean:= (value As TAbstractcolumns).nn;
    FieldByName('Ai').AsBoolean:= (value As TAbstractcolumns).Ai;
    FieldByName('Pk').AsBoolean:= (value As TAbstractcolumns).Pk;
    FieldByName('cdefault').AsString:= (value As TAbstractcolumns).cdefault;
    FieldByName('showname').AsString:= (value As TAbstractcolumns).showname;
    FieldByName('width').AsInteger:= (value As TAbstractcolumns).width;
    FieldByName('edittype').AsString:= (value As TAbstractcolumns).edittype;
    FieldByName('visible').AsBoolean:= (value As TAbstractcolumns).visible;
    FieldByName('comments').AsString:= (value As TAbstractcolumns).comments;
  end;
End;
//-- Abstractindexes
function TAbstractindexes.Clone:TAbstractModel;
begin
  result:=TAbstractindexes.create;
end;
Procedure TAbstractindexes.Setid(value : integer);
begin
  Fid:=value;
end;
Procedure TAbstractindexes.Settable_id(value : integer);
begin
  Ftable_id:=value;
end;
Procedure TAbstractindexes.Setname(value : string);
begin
  Fname:=value;
end;
Procedure TAbstractindexes.SetIndextype(value : string);
begin
  FIndextype:=value;
end;
Procedure TAbstractindexes.Setcolumn_id(value : integer);
begin
  Fcolumn_id:=value;
end;
Procedure TAbstractindexes.Setcolumn_seq(value : integer);
begin
  Fcolumn_seq:=value;
end;
Procedure TAbstractindexes.Setcorder(value : integer);
begin
  Fcorder:=value;
end;
Procedure TAbstractindexes.Setcomments(value : string);
begin
  Fcomments:=value;
end;
procedure TindexesDAO.SetTableName(value:string);
Begin
  FTableName:=value
End;
function TindexesDAO.DoInsert(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
    with qp do
    Begin
      close;
      SQL.Clear;
      SQL.add('Insert Into indexes');
      SQL.add('(table_id,name,Indextype,column_id,column_seq,');
      SQL.add( 'corder,comments)');
      SQL.add(' values( :table_id,:name,:Indextype,:column_id,:column_seq,');
      SQL.Add(':corder,:comments)');
      SetParamValue('table_id', (value as TAbstractindexes).table_id);
      SetParamValue('name', (value as TAbstractindexes).name);
      SetParamValue('Indextype', (value as TAbstractindexes).Indextype);
      SetParamValue('column_id', (value as TAbstractindexes).column_id);
      SetParamValue('column_seq', (value as TAbstractindexes).column_seq);
      SetParamValue('corder', (value as TAbstractindexes).corder);
      SetParamValue('comments', (value as TAbstractindexes).comments);
      SQL.Add('select SCOPE_IDENTITY() as id');
      Open;
      (value as TAbstractindexes).id:=  FieldByName('id').AsInteger;
      result:=true;
    end;
  finally
    qp.free;
  end;
End;
function TindexesDAO.DoUpdate(value:TAbstractModel;q1:TDataSet;Conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
    with qp do
    Begin
      close;
      SQL.Clear;
      SQL.Add('Update indexes  set ');
      SQL.add('table_id=:table_id,name=:name,Indextype=:Indextype,column_id=:column_id,column_seq=:column_seq,');
      SQL.add('corder=:corder,comments=:comments ');
      if ( conditions='') then
      begin
        SQL.Add(' where id=:id');
       SetParamValue('id', (value as TAbstractindexes).id);
      end else
      begin
        SQL.ADD( 'where '+conditions);
      end;
       SetParamValue('table_id', (value as TAbstractindexes).table_id);
       SetParamValue('name', (value as TAbstractindexes).name);
       SetParamValue('Indextype', (value as TAbstractindexes).Indextype);
       SetParamValue('column_id', (value as TAbstractindexes).column_id);
       SetParamValue('column_seq', (value as TAbstractindexes).column_seq);
       SetParamValue('corder', (value as TAbstractindexes).corder);
       SetParamValue('comments', (value as TAbstractindexes).comments);
      ExecSQL;
      result:=True;
    end;
  finally
    qp.free;
  end;
End;
function TindexesDAO.DoDelete(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
  with qp do
  Begin
    close;
    SQL.Clear;
    if( conditions='') then
    begin
      SQL.Add('Delete from indexes where id=:id');
      SetParamValue('id',( value as TAbstractindexes).id);
    end else
      SQL.Add('Delete from indexes where  '+conditions);
    ExecSQL;
    result:=true;
  end;
  finally
    qp.free;
  end;
End;
function TindexesDAO.DoSelect(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
  with qp do
  Begin
    close;
    SQL.Clear;
    s1 := 'Select * from indexes  ';
    if(conditions='') then
    begin
      s1 := s1 + ' where id=:id';
      SQL.Add(s1);
      SetParamValue('id',(value As TAbstractindexes).id);
    end else
    begin
       s1:=s1+' where '+conditions;
       SQL.Add(s1);
    end;
    Open;
    result:=True;
  end;
  finally
    qp.free;
  end;
End;
function TindexesDAO.Retrieve(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
Begin
  with q1 do
  Begin
    (value As TAbstractindexes).id:=FieldByName('id').AsInteger;
    (value As TAbstractindexes).table_id:=FieldByName('table_id').AsInteger;
    (value As TAbstractindexes).name:=Trim(FieldByName('name').AsString);
    (value As TAbstractindexes).Indextype:=Trim(FieldByName('Indextype').AsString);
    (value As TAbstractindexes).column_id:=FieldByName('column_id').AsInteger;
    (value As TAbstractindexes).column_seq:=FieldByName('column_seq').AsInteger;
    (value As TAbstractindexes).corder:=FieldByName('corder').AsInteger;
    (value As TAbstractindexes).comments:=Trim(FieldByName('comments').AsString);
  end;
End;
function TindexesDAO.SetValue(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
Begin
  with q1 do
  Begin
    FieldByName('table_id').AsInteger:= (value As TAbstractindexes).table_id;
    FieldByName('name').AsString:= (value As TAbstractindexes).name;
    FieldByName('Indextype').AsString:= (value As TAbstractindexes).Indextype;
    FieldByName('column_id').AsInteger:= (value As TAbstractindexes).column_id;
    FieldByName('column_seq').AsInteger:= (value As TAbstractindexes).column_seq;
    FieldByName('corder').AsInteger:= (value As TAbstractindexes).corder;
    FieldByName('comments').AsString:= (value As TAbstractindexes).comments;
  end;
End;
//-- AbstractfrKeys
function TAbstractfrKeys.Clone:TAbstractModel;
begin
  result:=TAbstractfrKeys.create;
end;
Procedure TAbstractfrKeys.Setid(value : integer);
begin
  Fid:=value;
end;
Procedure TAbstractfrKeys.Settable_id(value : integer);
begin
  Ftable_id:=value;
end;
Procedure TAbstractfrKeys.Setname(value : string);
begin
  Fname:=value;
end;
Procedure TAbstractfrKeys.Setcolumn_id(value : integer);
begin
  Fcolumn_id:=value;
end;
Procedure TAbstractfrKeys.Setrefer_table_id(value : integer);
begin
  Frefer_table_id:=value;
end;
Procedure TAbstractfrKeys.Setrefer_column_id(value : integer);
begin
  Frefer_column_id:=value;
end;
Procedure TAbstractfrKeys.Setcomments(value : string);
begin
  Fcomments:=value;
end;
Procedure TAbstractfrKeys.Setsubtable(value : boolean);
begin
  Fsubtable:=value;
end;
procedure TfrKeysDAO.SetTableName(value:string);
Begin
  FTableName:=value
End;
function TfrKeysDAO.DoInsert(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
    with qp do
    Begin
      close;
      SQL.Clear;
      SQL.add('Insert Into frKeys');
      SQL.add('(table_id,name,column_id,refer_table_id,refer_column_id,');
      SQL.add( 'comments,subtable)');
      SQL.add(' values( :table_id,:name,:column_id,:refer_table_id,:refer_column_id,');
      SQL.Add(':comments,:subtable)');
      SetParamValue('table_id', (value as TAbstractfrKeys).table_id);
      SetParamValue('name', (value as TAbstractfrKeys).name);
      SetParamValue('column_id', (value as TAbstractfrKeys).column_id);
      SetParamValue('refer_table_id', (value as TAbstractfrKeys).refer_table_id);
      SetParamValue('refer_column_id', (value as TAbstractfrKeys).refer_column_id);
      SetParamValue('comments', (value as TAbstractfrKeys).comments);
      SetParamValue('subtable', (value as TAbstractfrKeys).subtable);
      SQL.Add('select SCOPE_IDENTITY() as id');
      Open;
      (value as TAbstractfrKeys).id:=  FieldByName('id').AsInteger;
      result:=true;
    end;
  finally
    qp.free;
  end;
End;
function TfrKeysDAO.DoUpdate(value:TAbstractModel;q1:TDataSet;Conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
    with qp do
    Begin
      close;
      SQL.Clear;
      SQL.Add('Update frKeys  set ');
      SQL.add('table_id=:table_id,name=:name,column_id=:column_id,refer_table_id=:refer_table_id,refer_column_id=:refer_column_id,');
      SQL.add('comments=:comments,subtable=:subtable ');
      if ( conditions='') then
      begin
        SQL.Add(' where id=:id');
       SetParamValue('id', (value as TAbstractfrKeys).id);
      end else
      begin
        SQL.ADD( 'where '+conditions);
      end;
       SetParamValue('table_id', (value as TAbstractfrKeys).table_id);
       SetParamValue('name', (value as TAbstractfrKeys).name);
       SetParamValue('column_id', (value as TAbstractfrKeys).column_id);
       SetParamValue('refer_table_id', (value as TAbstractfrKeys).refer_table_id);
       SetParamValue('refer_column_id', (value as TAbstractfrKeys).refer_column_id);
       SetParamValue('comments', (value as TAbstractfrKeys).comments);
       SetParamValue('subtable', (value as TAbstractfrKeys).subtable);
      ExecSQL;
      result:=True;
    end;
  finally
    qp.free;
  end;
End;
function TfrKeysDAO.DoDelete(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
  with qp do
  Begin
    close;
    SQL.Clear;
    if( conditions='') then
    begin
      SQL.Add('Delete from frKeys where id=:id');
      SetParamValue('id',( value as TAbstractfrKeys).id);
    end else
      SQL.Add('Delete from frKeys where  '+conditions);
    ExecSQL;
    result:=true;
  end;
  finally
    qp.free;
  end;
End;
function TfrKeysDAO.DoSelect(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
  with qp do
  Begin
    close;
    SQL.Clear;
    s1 := 'Select * from frKeys  ';
    if(conditions='') then
    begin
      s1 := s1 + ' where id=:id';
      SQL.Add(s1);
      SetParamValue('id',(value As TAbstractfrKeys).id);
    end else
    begin
       s1:=s1+' where '+conditions;
       SQL.Add(s1);
    end;
    Open;
    result:=True;
  end;
  finally
    qp.free;
  end;
End;
function TfrKeysDAO.Retrieve(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
Begin
  with q1 do
  Begin
    (value As TAbstractfrKeys).id:=FieldByName('id').AsInteger;
    (value As TAbstractfrKeys).table_id:=FieldByName('table_id').AsInteger;
    (value As TAbstractfrKeys).name:=Trim(FieldByName('name').AsString);
    (value As TAbstractfrKeys).column_id:=FieldByName('column_id').AsInteger;
    (value As TAbstractfrKeys).refer_table_id:=FieldByName('refer_table_id').AsInteger;
    (value As TAbstractfrKeys).refer_column_id:=FieldByName('refer_column_id').AsInteger;
    (value As TAbstractfrKeys).comments:=Trim(FieldByName('comments').AsString);
    (value As TAbstractfrKeys).subtable:=FieldByName('subtable').AsBoolean;
  end;
End;
function TfrKeysDAO.SetValue(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
Begin
  with q1 do
  Begin
    FieldByName('table_id').AsInteger:= (value As TAbstractfrKeys).table_id;
    FieldByName('name').AsString:= (value As TAbstractfrKeys).name;
    FieldByName('column_id').AsInteger:= (value As TAbstractfrKeys).column_id;
    FieldByName('refer_table_id').AsInteger:= (value As TAbstractfrKeys).refer_table_id;
    FieldByName('refer_column_id').AsInteger:= (value As TAbstractfrKeys).refer_column_id;
    FieldByName('comments').AsString:= (value As TAbstractfrKeys).comments;
    FieldByName('subtable').AsBoolean:= (value As TAbstractfrKeys).subtable;
  end;
End;
//-- Abstractsystypesx
function TAbstractsystypesx.Clone:TAbstractModel;
begin
  result:=TAbstractsystypesx.create;
end;
Procedure TAbstractsystypesx.Setxtype(value : integer);
begin
  Fxtype:=value;
end;
Procedure TAbstractsystypesx.Setname(value : string);
begin
  Fname:=value;
end;
procedure TsystypesxDAO.SetTableName(value:string);
Begin
  FTableName:=value
End;
function TsystypesxDAO.DoInsert(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
    with qp do
    Begin
      close;
      SQL.Clear;
      SQL.add('Insert Into systypesx');
      SQL.add( '(xtype,name)');
      SQL.Add(' values( :xtype,:name)');
      SetParamValue('xtype', (value as TAbstractsystypesx).xtype);
      SetParamValue('name', (value as TAbstractsystypesx).name);
      ExecSQL;
      result:=true;
    end;
  finally
    qp.free;
  end;
End;
function TsystypesxDAO.DoUpdate(value:TAbstractModel;q1:TDataSet;Conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
    with qp do
    Begin
      close;
      SQL.Clear;
      SQL.Add('Update systypesx  set ');
      SQL.add('xtype=:xtype,name=:name ');
      if ( conditions='') then
      begin
        SQL.Add(' where xtype=:xtype');
       SetParamValue('xtype', (value as TAbstractsystypesx).xtype);
      end else
      begin
        SQL.ADD( 'where '+conditions);
      end;
       SetParamValue('xtype', (value as TAbstractsystypesx).xtype);
       SetParamValue('name', (value as TAbstractsystypesx).name);
      ExecSQL;
      result:=True;
    end;
  finally
    qp.free;
  end;
End;
function TsystypesxDAO.DoDelete(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
  with qp do
  Begin
    close;
    SQL.Clear;
    if( conditions='') then
    begin
      SQL.Add('Delete from systypesx where xtype=:xtype');
      SetParamValue('xtype',( value as TAbstractsystypesx).xtype);
    end else
      SQL.Add('Delete from systypesx where  '+conditions);
    ExecSQL;
    result:=true;
  end;
  finally
    qp.free;
  end;
End;
function TsystypesxDAO.DoSelect(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
  with qp do
  Begin
    close;
    SQL.Clear;
    s1 := 'Select * from systypesx  ';
    if(conditions='') then
    begin
      s1 := s1 + ' where xtype=:xtype';
      SQL.Add(s1);
      SetParamValue('xtype',(value As TAbstractsystypesx).xtype);
    end else
    begin
       s1:=s1+' where '+conditions;
       SQL.Add(s1);
    end;
    Open;
    result:=True;
  end;
  finally
    qp.free;
  end;
End;
function TsystypesxDAO.Retrieve(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
Begin
  with q1 do
  Begin
    (value As TAbstractsystypesx).xtype:=FieldByName('xtype').AsInteger;
    (value As TAbstractsystypesx).name:=Trim(FieldByName('name').AsString);
  end;
End;
function TsystypesxDAO.SetValue(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
Begin
  with q1 do
  Begin
    FieldByName('xtype').AsInteger:= (value As TAbstractsystypesx).xtype;
    FieldByName('name').AsString:= (value As TAbstractsystypesx).name;
  end;
End;
//-- Abstractusertypes
function TAbstractusertypes.Clone:TAbstractModel;
begin
  result:=TAbstractusertypes.create;
end;
Procedure TAbstractusertypes.Setid(value : integer);
begin
  Fid:=value;
end;
Procedure TAbstractusertypes.Setname(value : string);
begin
  Fname:=value;
end;
Procedure TAbstractusertypes.Setxtype(value : integer);
begin
  Fxtype:=value;
end;
Procedure TAbstractusertypes.Settdefault(value : integer);
begin
  Ftdefault:=value;
end;
Procedure TAbstractusertypes.Setallownulls(value : boolean);
begin
  Fallownulls:=value;
end;
Procedure TAbstractusertypes.Setprec(value : integer);
begin
  Fprec:=value;
end;
Procedure TAbstractusertypes.Setscale(value : integer);
begin
  Fscale:=value;
end;
procedure TusertypesDAO.SetTableName(value:string);
Begin
  FTableName:=value
End;
function TusertypesDAO.DoInsert(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
    with qp do
    Begin
      close;
      SQL.Clear;
      SQL.add('Insert Into usertypes');
      SQL.add('(name,xtype,tdefault,allownulls,prec,');
      SQL.add( 'scale)');
      SQL.add(' values( :name,:xtype,:tdefault,:allownulls,:prec,');
      SQL.Add(':scale)');
      SetParamValue('name', (value as TAbstractusertypes).name);
      SetParamValue('xtype', (value as TAbstractusertypes).xtype);
      SetParamValue('tdefault', (value as TAbstractusertypes).tdefault);
      SetParamValue('allownulls', (value as TAbstractusertypes).allownulls);
      SetParamValue('prec', (value as TAbstractusertypes).prec);
      SetParamValue('scale', (value as TAbstractusertypes).scale);
      SQL.Add('select SCOPE_IDENTITY() as id');
      Open;
      (value as TAbstractusertypes).id:=  FieldByName('id').AsInteger;
      result:=true;
    end;
  finally
    qp.free;
  end;
End;
function TusertypesDAO.DoUpdate(value:TAbstractModel;q1:TDataSet;Conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
    with qp do
    Begin
      close;
      SQL.Clear;
      SQL.Add('Update usertypes  set ');
      SQL.add('name=:name,xtype=:xtype,tdefault=:tdefault,allownulls=:allownulls,prec=:prec,');
      SQL.add('scale=:scale ');
      if ( conditions='') then
      begin
        SQL.Add(' where id=:id');
       SetParamValue('id', (value as TAbstractusertypes).id);
      end else
      begin
        SQL.ADD( 'where '+conditions);
      end;
       SetParamValue('name', (value as TAbstractusertypes).name);
       SetParamValue('xtype', (value as TAbstractusertypes).xtype);
       SetParamValue('tdefault', (value as TAbstractusertypes).tdefault);
       SetParamValue('allownulls', (value as TAbstractusertypes).allownulls);
       SetParamValue('prec', (value as TAbstractusertypes).prec);
       SetParamValue('scale', (value as TAbstractusertypes).scale);
      ExecSQL;
      result:=True;
    end;
  finally
    qp.free;
  end;
End;
function TusertypesDAO.DoDelete(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
  with qp do
  Begin
    close;
    SQL.Clear;
    if( conditions='') then
    begin
      SQL.Add('Delete from usertypes where id=:id');
      SetParamValue('id',( value as TAbstractusertypes).id);
    end else
      SQL.Add('Delete from usertypes where  '+conditions);
    ExecSQL;
    result:=true;
  end;
  finally
    qp.free;
  end;
End;
function TusertypesDAO.DoSelect(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
  with qp do
  Begin
    close;
    SQL.Clear;
    s1 := 'Select * from usertypes  ';
    if(conditions='') then
    begin
      s1 := s1 + ' where id=:id';
      SQL.Add(s1);
      SetParamValue('id',(value As TAbstractusertypes).id);
    end else
    begin
       s1:=s1+' where '+conditions;
       SQL.Add(s1);
    end;
    Open;
    result:=True;
  end;
  finally
    qp.free;
  end;
End;
function TusertypesDAO.Retrieve(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
Begin
  with q1 do
  Begin
    (value As TAbstractusertypes).id:=FieldByName('id').AsInteger;
    (value As TAbstractusertypes).name:=Trim(FieldByName('name').AsString);
    (value As TAbstractusertypes).xtype:=FieldByName('xtype').AsInteger;
    (value As TAbstractusertypes).tdefault:=FieldByName('tdefault').AsInteger;
    (value As TAbstractusertypes).allownulls:=FieldByName('allownulls').AsBoolean;
    (value As TAbstractusertypes).prec:=FieldByName('prec').AsInteger;
    (value As TAbstractusertypes).scale:=FieldByName('scale').AsInteger;
  end;
End;
function TusertypesDAO.SetValue(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
Begin
  with q1 do
  Begin
    FieldByName('name').AsString:= (value As TAbstractusertypes).name;
    FieldByName('xtype').AsInteger:= (value As TAbstractusertypes).xtype;
    FieldByName('tdefault').AsInteger:= (value As TAbstractusertypes).tdefault;
    FieldByName('allownulls').AsBoolean:= (value As TAbstractusertypes).allownulls;
    FieldByName('prec').AsInteger:= (value As TAbstractusertypes).prec;
    FieldByName('scale').AsInteger:= (value As TAbstractusertypes).scale;
  end;
End;
//-- Abstractdefaults
function TAbstractdefaults.Clone:TAbstractModel;
begin
  result:=TAbstractdefaults.create;
end;
Procedure TAbstractdefaults.Setid(value : integer);
begin
  Fid:=value;
end;
Procedure TAbstractdefaults.Setname(value : string);
begin
  Fname:=value;
end;
Procedure TAbstractdefaults.Setdtext(value : Variant);
begin
  Fdtext:=value;
end;
procedure TdefaultsDAO.SetTableName(value:string);
Begin
  FTableName:=value
End;
function TdefaultsDAO.DoInsert(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
    with qp do
    Begin
      close;
      SQL.Clear;
      SQL.add('Insert Into defaults');
      SQL.add( '(id,name,dtext)');
      SQL.Add(' values( :id,:name,:dtext)');
      SetParamValue('id', (value as TAbstractdefaults).id);
      SetParamValue('name', (value as TAbstractdefaults).name);
      SetParamValue('dtext', (value as TAbstractdefaults).dtext);
      ExecSQL;
      result:=true;
    end;
  finally
    qp.free;
  end;
End;
function TdefaultsDAO.DoUpdate(value:TAbstractModel;q1:TDataSet;Conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
    with qp do
    Begin
      close;
      SQL.Clear;
      SQL.Add('Update defaults  set ');
      SQL.add('id=:id,name=:name,dtext=:dtext ');
      if ( conditions='') then
      begin
        SQL.Add(' where id=:id');
       SetParamValue('id', (value as TAbstractdefaults).id);
      end else
      begin
        SQL.ADD( 'where '+conditions);
      end;
       SetParamValue('id', (value as TAbstractdefaults).id);
       SetParamValue('name', (value as TAbstractdefaults).name);
       SetParamValue('dtext', (value as TAbstractdefaults).dtext);
      ExecSQL;
      result:=True;
    end;
  finally
    qp.free;
  end;
End;
function TdefaultsDAO.DoDelete(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
  with qp do
  Begin
    close;
    SQL.Clear;
    if( conditions='') then
    begin
      SQL.Add('Delete from defaults where id=:id');
      SetParamValue('id',( value as TAbstractdefaults).id);
    end else
      SQL.Add('Delete from defaults where  '+conditions);
    ExecSQL;
    result:=true;
  end;
  finally
    qp.free;
  end;
End;
function TdefaultsDAO.DoSelect(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
  with qp do
  Begin
    close;
    SQL.Clear;
    s1 := 'Select * from defaults  ';
    if(conditions='') then
    begin
      s1 := s1 + ' where id=:id';
      SQL.Add(s1);
      SetParamValue('id',(value As TAbstractdefaults).id);
    end else
    begin
       s1:=s1+' where '+conditions;
       SQL.Add(s1);
    end;
    Open;
    result:=True;
  end;
  finally
    qp.free;
  end;
End;
function TdefaultsDAO.Retrieve(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
Begin
  with q1 do
  Begin
    (value As TAbstractdefaults).id:=FieldByName('id').AsInteger;
    (value As TAbstractdefaults).name:=Trim(FieldByName('name').AsString);
    (value As TAbstractdefaults).dtext:=FieldByName('dtext').AsVariant;
  end;
End;
function TdefaultsDAO.SetValue(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
Begin
  with q1 do
  Begin
    FieldByName('id').AsInteger:= (value As TAbstractdefaults).id;
    FieldByName('name').AsString:= (value As TAbstractdefaults).name;
    FieldByName('dtext').AsVariant:= (value As TAbstractdefaults).dtext;
  end;
End;
//-- Abstracttrigers
function TAbstracttrigers.Clone:TAbstractModel;
begin
  result:=TAbstracttrigers.create;
end;
Procedure TAbstracttrigers.Setid(value : integer);
begin
  Fid:=value;
end;
Procedure TAbstracttrigers.Setname(value : string);
begin
  Fname:=value;
end;
Procedure TAbstracttrigers.Settable_id(value : integer);
begin
  Ftable_id:=value;
end;
Procedure TAbstracttrigers.Setdtext(value : Variant);
begin
  Fdtext:=value;
end;
procedure TtrigersDAO.SetTableName(value:string);
Begin
  FTableName:=value
End;
function TtrigersDAO.DoInsert(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
    with qp do
    Begin
      close;
      SQL.Clear;
      SQL.add('Insert Into trigers');
      SQL.add( '(id,name,table_id,dtext)');
      SQL.Add(' values( :id,:name,:table_id,:dtext)');
      SetParamValue('id', (value as TAbstracttrigers).id);
      SetParamValue('name', (value as TAbstracttrigers).name);
      SetParamValue('table_id', (value as TAbstracttrigers).table_id);
      SetParamValue('dtext', (value as TAbstracttrigers).dtext);
      ExecSQL;
      result:=true;
    end;
  finally
    qp.free;
  end;
End;
function TtrigersDAO.DoUpdate(value:TAbstractModel;q1:TDataSet;Conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
    with qp do
    Begin
      close;
      SQL.Clear;
      SQL.Add('Update trigers  set ');
      SQL.add('id=:id,name=:name,table_id=:table_id,dtext=:dtext ');
      if ( conditions='') then
      begin
        SQL.Add(' where id=:id');
       SetParamValue('id', (value as TAbstracttrigers).id);
      end else
      begin
        SQL.ADD( 'where '+conditions);
      end;
       SetParamValue('id', (value as TAbstracttrigers).id);
       SetParamValue('name', (value as TAbstracttrigers).name);
       SetParamValue('table_id', (value as TAbstracttrigers).table_id);
       SetParamValue('dtext', (value as TAbstracttrigers).dtext);
      ExecSQL;
      result:=True;
    end;
  finally
    qp.free;
  end;
End;
function TtrigersDAO.DoDelete(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
  with qp do
  Begin
    close;
    SQL.Clear;
    if( conditions='') then
    begin
      SQL.Add('Delete from trigers where id=:id');
      SetParamValue('id',( value as TAbstracttrigers).id);
    end else
      SQL.Add('Delete from trigers where  '+conditions);
    ExecSQL;
    result:=true;
  end;
  finally
    qp.free;
  end;
End;
function TtrigersDAO.DoSelect(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
  with qp do
  Begin
    close;
    SQL.Clear;
    s1 := 'Select * from trigers  ';
    if(conditions='') then
    begin
      s1 := s1 + ' where id=:id';
      SQL.Add(s1);
      SetParamValue('id',(value As TAbstracttrigers).id);
    end else
    begin
       s1:=s1+' where '+conditions;
       SQL.Add(s1);
    end;
    Open;
    result:=True;
  end;
  finally
    qp.free;
  end;
End;
function TtrigersDAO.Retrieve(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
Begin
  with q1 do
  Begin
    (value As TAbstracttrigers).id:=FieldByName('id').AsInteger;
    (value As TAbstracttrigers).name:=Trim(FieldByName('name').AsString);
    (value As TAbstracttrigers).table_id:=FieldByName('table_id').AsInteger;
    (value As TAbstracttrigers).dtext:=FieldByName('dtext').AsVariant;
  end;
End;
function TtrigersDAO.SetValue(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
Begin
  with q1 do
  Begin
    FieldByName('id').AsInteger:= (value As TAbstracttrigers).id;
    FieldByName('name').AsString:= (value As TAbstracttrigers).name;
    FieldByName('table_id').AsInteger:= (value As TAbstracttrigers).table_id;
    FieldByName('dtext').AsVariant:= (value As TAbstracttrigers).dtext;
  end;
End;
//-- Abstractviews
function TAbstractviews.Clone:TAbstractModel;
begin
  result:=TAbstractviews.create;
end;
Procedure TAbstractviews.Setid(value : integer);
begin
  Fid:=value;
end;
Procedure TAbstractviews.Setname(value : string);
begin
  Fname:=value;
end;
Procedure TAbstractviews.Setdtext(value : Variant);
begin
  Fdtext:=value;
end;
procedure TviewsDAO.SetTableName(value:string);
Begin
  FTableName:=value
End;
function TviewsDAO.DoInsert(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
    with qp do
    Begin
      close;
      SQL.Clear;
      SQL.add('Insert Into views');
      SQL.add( '(id,name,dtext)');
      SQL.Add(' values( :id,:name,:dtext)');
      SetParamValue('id', (value as TAbstractviews).id);
      SetParamValue('name', (value as TAbstractviews).name);
      SetParamValue('dtext', (value as TAbstractviews).dtext);
      ExecSQL;
      result:=true;
    end;
  finally
    qp.free;
  end;
End;
function TviewsDAO.DoUpdate(value:TAbstractModel;q1:TDataSet;Conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
    with qp do
    Begin
      close;
      SQL.Clear;
      SQL.Add('Update views  set ');
      SQL.add('id=:id,name=:name,dtext=:dtext ');
      if ( conditions='') then
      begin
        SQL.Add(' where id=:id');
       SetParamValue('id', (value as TAbstractviews).id);
      end else
      begin
        SQL.ADD( 'where '+conditions);
      end;
       SetParamValue('id', (value as TAbstractviews).id);
       SetParamValue('name', (value as TAbstractviews).name);
       SetParamValue('dtext', (value as TAbstractviews).dtext);
      ExecSQL;
      result:=True;
    end;
  finally
    qp.free;
  end;
End;
function TviewsDAO.DoDelete(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
  with qp do
  Begin
    close;
    SQL.Clear;
    if( conditions='') then
    begin
      SQL.Add('Delete from views where id=:id');
      SetParamValue('id',( value as TAbstractviews).id);
    end else
      SQL.Add('Delete from views where  '+conditions);
    ExecSQL;
    result:=true;
  end;
  finally
    qp.free;
  end;
End;
function TviewsDAO.DoSelect(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
  with qp do
  Begin
    close;
    SQL.Clear;
    s1 := 'Select * from views  ';
    if(conditions='') then
    begin
      s1 := s1 + ' where id=:id';
      SQL.Add(s1);
      SetParamValue('id',(value As TAbstractviews).id);
    end else
    begin
       s1:=s1+' where '+conditions;
       SQL.Add(s1);
    end;
    Open;
    result:=True;
  end;
  finally
    qp.free;
  end;
End;
function TviewsDAO.Retrieve(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
Begin
  with q1 do
  Begin
    (value As TAbstractviews).id:=FieldByName('id').AsInteger;
    (value As TAbstractviews).name:=Trim(FieldByName('name').AsString);
    (value As TAbstractviews).dtext:=FieldByName('dtext').AsVariant;
  end;
End;
function TviewsDAO.SetValue(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
Begin
  with q1 do
  Begin
    FieldByName('id').AsInteger:= (value As TAbstractviews).id;
    FieldByName('name').AsString:= (value As TAbstractviews).name;
    FieldByName('dtext').AsVariant:= (value As TAbstractviews).dtext;
  end;
End;
//-- Abstractprocedures
function TAbstractprocedures.Clone:TAbstractModel;
begin
  result:=TAbstractprocedures.create;
end;
Procedure TAbstractprocedures.Setid(value : integer);
begin
  Fid:=value;
end;
Procedure TAbstractprocedures.Setname(value : string);
begin
  Fname:=value;
end;
Procedure TAbstractprocedures.Setdtext(value : Variant);
begin
  Fdtext:=value;
end;
procedure TproceduresDAO.SetTableName(value:string);
Begin
  FTableName:=value
End;
function TproceduresDAO.DoInsert(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
    with qp do
    Begin
      close;
      SQL.Clear;
      SQL.add('Insert Into procedures');
      SQL.add( '(id,name,dtext)');
      SQL.Add(' values( :id,:name,:dtext)');
      SetParamValue('id', (value as TAbstractprocedures).id);
      SetParamValue('name', (value as TAbstractprocedures).name);
      SetParamValue('dtext', (value as TAbstractprocedures).dtext);
      ExecSQL;
      result:=true;
    end;
  finally
    qp.free;
  end;
End;
function TproceduresDAO.DoUpdate(value:TAbstractModel;q1:TDataSet;Conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
    with qp do
    Begin
      close;
      SQL.Clear;
      SQL.Add('Update procedures  set ');
      SQL.add('id=:id,name=:name,dtext=:dtext ');
      if ( conditions='') then
      begin
        SQL.Add(' where id=:id');
       SetParamValue('id', (value as TAbstractprocedures).id);
      end else
      begin
        SQL.ADD( 'where '+conditions);
      end;
       SetParamValue('id', (value as TAbstractprocedures).id);
       SetParamValue('name', (value as TAbstractprocedures).name);
       SetParamValue('dtext', (value as TAbstractprocedures).dtext);
      ExecSQL;
      result:=True;
    end;
  finally
    qp.free;
  end;
End;
function TproceduresDAO.DoDelete(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
  with qp do
  Begin
    close;
    SQL.Clear;
    if( conditions='') then
    begin
      SQL.Add('Delete from procedures where id=:id');
      SetParamValue('id',( value as TAbstractprocedures).id);
    end else
      SQL.Add('Delete from procedures where  '+conditions);
    ExecSQL;
    result:=true;
  end;
  finally
    qp.free;
  end;
End;
function TproceduresDAO.DoSelect(value:TAbstractModel;q1:TDataSet;conditions:string=''):Boolean;
var
  s1:string;
  qp:TQueryProxy;
Begin
  qp:=TQueryProxy.Create;
  qp.dataset:=q1;
  try
  with qp do
  Begin
    close;
    SQL.Clear;
    s1 := 'Select * from procedures  ';
    if(conditions='') then
    begin
      s1 := s1 + ' where id=:id';
      SQL.Add(s1);
      SetParamValue('id',(value As TAbstractprocedures).id);
    end else
    begin
       s1:=s1+' where '+conditions;
       SQL.Add(s1);
    end;
    Open;
    result:=True;
  end;
  finally
    qp.free;
  end;
End;
function TproceduresDAO.Retrieve(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
Begin
  with q1 do
  Begin
    (value As TAbstractprocedures).id:=FieldByName('id').AsInteger;
    (value As TAbstractprocedures).name:=Trim(FieldByName('name').AsString);
    (value As TAbstractprocedures).dtext:=FieldByName('dtext').AsVariant;
  end;
End;
function TproceduresDAO.SetValue(value:TAbstractModel;q1:TDataSet):Boolean;
var
  s1:string;
Begin
  with q1 do
  Begin
    FieldByName('id').AsInteger:= (value As TAbstractprocedures).id;
    FieldByName('name').AsString:= (value As TAbstractprocedures).name;
    FieldByName('dtext').AsVariant:= (value As TAbstractprocedures).dtext;
  end;
End;
Initialization
  tables:=TAbstracttables.Create;
  tablesDAO:=TtablesDAO.Create;
  columns:=TAbstractcolumns.Create;
  columnsDAO:=TcolumnsDAO.Create;
  indexes:=TAbstractindexes.Create;
  indexesDAO:=TindexesDAO.Create;
  frKeys:=TAbstractfrKeys.Create;
  frKeysDAO:=TfrKeysDAO.Create;
  systypesx:=TAbstractsystypesx.Create;
  systypesxDAO:=TsystypesxDAO.Create;
  usertypes:=TAbstractusertypes.Create;
  usertypesDAO:=TusertypesDAO.Create;
  defaults:=TAbstractdefaults.Create;
  defaultsDAO:=TdefaultsDAO.Create;
  trigers:=TAbstracttrigers.Create;
  trigersDAO:=TtrigersDAO.Create;
  views:=TAbstractviews.Create;
  viewsDAO:=TviewsDAO.Create;
  procedures:=TAbstractprocedures.Create;
  proceduresDAO:=TproceduresDAO.Create;
end.
